package com.test.springbootweb.Controller;

import com.test.springbootweb.Pojo.Adress;
import com.test.springbootweb.Pojo.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class demo_Restcontroller {
    @RequestMapping("/hello")
    public Result Hello(){
        System.out.println("hello!");
        return Result.success("hello!");
    }
    @RequestMapping("/getadress")
    public Result getadress(){
       Adress adress=new Adress();
       adress.setProvince("四川");
       adress.setCity("成都");
       return Result.success(adress);
    }
    public Result Listadress(){
        List<Adress> list=new ArrayList<>();

        Adress adress=new Adress();
        adress.setProvince("北京");
        adress.setCity("北京");

        Adress adress1=new Adress();
        adress1.setProvince("天津");
        adress1.setCity("天津");

        list.add(adress);
        list.add(adress1);

        return Result.success(list);
    }
}
